import type { MultipleConditionSearchSchema } from '@/components/multiple-condition-search/types'

export default function useConfig() {
  const searchSchema = computed<MultipleConditionSearchSchema>(() => {
    return {
      placeholder: '默认按照备注搜索',
      widgets: [
        {
          type: 'input',
          label: '备注',
          field: 'remark_keyword',
          maxLength: 200,
        },
        {
          type: 'input',
          label: '地址池',
          field: 'address_pool_name_keyword',
        },
        {
          type: 'input',
          label: '地址',
          field: 'address_ip_keyword',
        },
      ],
    }
  })

  const tableColumns = buildColumns([
    {
      title: '请求来源（地理位置）',
      dataIndex: 'name',
    },
    {
      title: '地址池集合',
      dataIndex: 'address_pool_sets',
      slotName: 'address',
    },
    {
      title: '备注',
      dataIndex: 'remark',
      slotName: 'remark',
    },
    {
      title: '状态',
      dataIndex: 'status',
      slotName: 'status',
    },
    {
      title: '创建时间 ',
      dataIndex: 'created_at',
      format: 'date-time',
      sortable: sortableSettings,
    },
    {
      title: '操作',
      fixed: 'right',
      slotName: 'actions',
      width: 80,
      cellClass: 'actions-cell',
    },
  ])

  return {
    searchSchema,
    tableColumns,
  }
}
